{% load static %}
{% include "home/include/top.html" %}
<title>用户注册</title>
<meta name="keywords" content="">
<meta name="description" content="">
<link rel="shortcut icon" href="/favicon.ico"/>
<link rel="bookmark" href="/favicon.ico"/>
</head>
<body>
{% include "home/include/head.html" %}
{% include "home/include/banner_inner.html" %}
<div class="container">
    <div class="width ui-row">
        <div class="container-left">
            <div class="ui-fixed-s" data-parent=".container">
                {% include "users/nav.html" %}
            </div>
        </div>
        
        <div class="container-right">
        
            <div class="ui-box">
                <div class="ui-box-h2">用户登录</div>
                <div class="ui-box-body">
                    <!--begin-->
                    <div class="ui-pt-40">
                        <form method="post" class="ui-form ui-ml-40">
                            {% csrf_token %}
                            <div class="ui-form-group ui-row">
                                <label class="ui-col-2 ui-col-form-label ui-text-right">用户名：</label>
                                <div class="ui-col-5">
                                    <input type="text" name="username" class="ui-form-ip" placeholder="请输入用户名" data-rule="用户名:required;username;">
                                </div>
                            </div>
                            <div class="ui-form-group ui-row">
                                <label class="ui-col-2 ui-col-form-label ui-text-right">密码：</label>
                                <div class="ui-col-5">
                                    <div class="ui-input-group">
                                        <input type="password" name="password" autocomplete="off" class="ui-form-ip radius-right-none" placeholder="请输入密码" data-rule="密码:required;password;">
                                        <div class="after"><a href="/" class="pl pr" tabindex="-1">忘记密码</a></div>
                                    </div>
                                </div>
                            </div>
                            <div class="ui-form-group ui-row">
                                <label class="ui-col-2 ui-col-form-label ui-text-right">验证码：</label>
                                <div class="ui-col-5">
                                    <div class="ui-input-group">
                                        <input type="hidden" id="captcha_0" name="captcha_0" value="{{ hashkey }}">
                                        <input type="text" name="captcha" id="code" class="ui-form-ip radius-right-none" placeholder="请输入验证码" data-rule="验证码:required;">
                                        <div class="code"><img src="{{ image_url }}" height="40" id="verify" title="点击更换验证码"></div>
                                    </div>
                                </div>
                            </div>
                            <div class="ui-form-group ui-row">
                                <label class="ui-col-2 ui-col-form-label ui-text-right"></label>
                                <div class="ui-col-5">
                                    <input type="hidden" name="token" value=""><input type="submit" class="ui-btn ui-btn-blue" value="登录">
                                </div>
                            </div>
                        </form>
                    </div>

                    <!--over-->
                </div>
            </div>
        
        </div>
    </div>
</div>

{% block foot %}
<!--FriendLink部分开始-->
<div class="width ui-mt-20 ui-mb-40">
    <div class="home-title">
        <div class="home-title-name">友情链接<span>Friend Link</span></div>
    </div>
    
    <div class="link">
        <a href="https://www.baidu.com" title="百度一下" target="_blank">百度一下</a>
    </div>
</div>
<!--FriendLink部分结束-->
<div class="footer">
    <div class="width ui-row">
		<div class="footer_item">
			<h4>作品案例</h4>
			<div class="footer_menu">
                <!-- <a href="" title="" target="_blank"></a> -->
			</div>
		</div>
        <div class="footer_item footer_last">
            <h5>微信</h5>
            <div class="footer_tel">
                weaimycn
                <img src="" class="ui-tips" data-align="top" data-width="300px" data-pic="">
            </div>
        </div>
        
        
    </div>
</div>
<div class="copyright">我的目的地　版权所有 © 2008-06 Inc.　<a href="https://beian.miit.gov.cn" target="_blank">冀ICP备2022017844号-1</a>　<a href="" target="_blank"></a>　<a href="/sitemap">网站地图</a></div>

<div class="ui-sidebar">
    <ul>
        <li><a href="http://wpa.qq.com/msgrd?v=3&uin=894835123&site=qq&menu=yes" target="_blank"><i class="ui-icon-qq"></i></a><div>客户服务</div></li>
        <li><a href="/book"><i class="ui-icon-edit"></i></a><div>在线留言</div></li>
        <li class="ui-backtop" id="backtop"><a href="javascript:;"><i class="ui-icon-top"></i></a><div>返回顶部</div></li>
    </ul>
</div>

<script src="{% static 'public/js/jquery.js' %}"></script>
<script src="{% static 'public/js/ui.js' %}"></script>
<script src="{% static 'home/js/cms.js' %}"></script>
{% endblock %}

{% block js %}
<script>
    $(function()
    {
    	$("#verify").click(function()
    	{
    		$.get('/captcha/refresh/', function (data) {
                $('#captcha_0').attr('value', data.key);
                $('#verify').attr('src', data.image_url);
            });
    		$("#code").val("");
    	});

    	$(".ui-form").form(
    	{
    		type:2,
    		align:'center',
    		result:function(form)
    		{
    			$.ajax(
				{
    				type:'post',
    				cache:false,
    				dataType:'json',
    				url:'{% url "users:login" %}',
    				data:$(form).serialize(),
    				error:function(e){alert(e.responseText);},
    				success:function(d)
    				{
    					if(d.state=='success')
    					{
    						wmcms.success(d.msg);
    						setTimeout(function(){location.href='{% url "users:index" %}';},1500);
    					}
    					else
    					{
                            $("#verify").click();
    						wmcms.error(d.msg);
    					}
    				}
    			});
    		}
    	});
    })
    </script>
{% endblock %}
</body>
</html>